#include <math.h>

#include "ge.h"
#include "gpu.h"

GPUgstate gstate;

float binToFloat(s32 bits)
{
    s32 s, e, m;
    float v;

    s = ((bits >> 31) == 0) ? 1 : -1; /* sign */
    e = ((bits >> 23) & 0xff); /* exposant */
    m = (e == 0) ?
                 (bits & 0x7fffff) << 1 :
                 (bits & 0x7fffff) | 0x800000; /* value */

    v = s * m * pow(2, e - 150);

    return v;
}

float getFloat24(s32 data)
{
    float v;
    data <<= 8;

    v = binToFloat(data);

    return v;
}

